< previous page page_373 next page >

Page 373
8694cbadb9b1ef7075903f6f95fc1db2.gif
   App.Title
 4:           Exit Sub
 5:     End If
 6:    If Dir(App.Path & \ & Report_Names(lstReportName.ListIndex) & .rpt)_
 7: =  Then
 8:         MsgBox Report: & Report_Names(lstReportName.ListIndex) &_
 9: cannot be found!, vbCritical, App.Title
10:         Exit Sub
11:     End If
12:     rptAddress.SelectionFormula = 
13:     rptAddress.ReportFileName = App.Path & \ &_
14: Report_Names(lstReportName.ListIndex) & .rpt
15:     rptAddress.WindowTitle = Address Book Reporting
16:     rptAddress.WindowMinButton = False
17:     If optDisplay(0).Value Then
18:         rptAddress.Destination = 0
19:     Else
20:         rptAddress.Destination = 1
21:     End If
22:     rptAddress.Action = 1
23: End Sub

Caution
Remember to select only the report(s) that you have already created.

Now, try running the application, selecting a report, and then clicking the Display command button. You now have a working report manager to use in any application that you need to include it in.
Summary
In this chapter, you saw how to use Crystal Reports to create professional looking reports with very little effort. In addition, you added the Crystal Reports Custom Control to a Visual Basic application and used it to run, and then display, a report in a window. Finally, you saw how to build a Report manager to enable the user to select a report to run and then print or display it. What you have done in this chapter has only scratched the surface of the Crystal Reports product and how you can use it in your application. However, it has given you a solid foundation to build on when adding reporting to your application.

 
< previous page page_373 next page >

If you like this book, buy it!